﻿@using KL.Store.Core
@{
    ViewBag.Title = "Dashboard Index";
    Layout = "~/Views/Shared/_LayoutReportPanel.cshtml";
}
<h2>Dashboard</h2>
<hr />
<div class="col-sm-12 first last">
    <div class="col-md-7 dashboardSection first last">
        <div id="sonSatislar" class="dashboardSectionInner">
            <h4>Son Satışlar<span class="hidden-md hidden-lg right">&nbsp;<a href="javascript:void(0);" class="sectionOC" onclick="expandSection('#sonSatislar');"><i class="fa fa-bars"></i></a></span></h4>
            <hr />
            <div id="LastSalesPlaceHolder">
                @{Html.RenderAction("LastSales", "ReportPanel", new { ItemCount = 10 }); }
            </div>
        </div>
    </div>
    <div class="col-md-5 dashboardSection last">
        <div id="kritikStoklar" class="dashboardSectionInner">
            <h4>Kritik Stoklar<span class="hidden-md hidden-lg right">&nbsp;<a href="javascript:void(0);" class="sectionOC" onclick="expandSection('#kritikStoklar');"><i class="fa fa-bars"></i></a></span></h4>
            <hr />
            <div id="LastCriticalStocksPlaceHolder">
                @{Html.RenderAction("LastCriticalStocks", "ReportPanel", new { StockCount = 10, MaximumStock = 5, Page = 1, AmbarId = 0, StockPerPage = 10 }); }
            </div>
        </div>
    </div>
</div>
<script>
    function RefreshLastSales()
    {
        $('#LastSalesPlaceHolder').load('/ReportPanel/LastSales', { ItemCount: 10 });
    }
    function RefreshLastCriticalStocks()
    {
        $('#LastCriticalStocksPlaceHolder').load('/ReportPanel/LastCriticalStocks', { StockCount: 10, MaximumStock: '@(Parameters.CriticalStockAlertAmount)', Page: 1, AmbarId: '0', StockPerPage: 10 });
    }
    var delay = 60;
    function Timer()
    {
        RefreshLastSales();
        RefreshLastCriticalStocks();
        window.setTimeout(Timer, delay * 1000);
    }
    window.setTimeout(Timer, delay * 1000);
</script>
